CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(Sleephi)

SET(LIBRARY_OUTPUT_PATH ${Sleephi_SOURCE_DIR}/Bin)
SET(EXECUTABLE_OUTPUT_PATH ${Sleephi_SOURCE_DIR}/Bin)

INCLUDE_DIRECTORIES(${Sleephi_SOURCE_DIR})
LINK_DIRECTORIES(${Sleephi_BINARY_DIR})

#set boost
SET(BOOST_INCLUDEDIR "/home/src/boost-trunk")
IF(BOOST_INCLUDEDIR AND NOT BOOST_LIBRARYDIR)
    SET(BOOST_LIBRARYDIR "${BOOST_INCLUDEDIR}/stage/lib")
ENDIF(BOOST_INCLUDEDIR AND NOT BOOST_LIBRARYDIR)

SET(Boost_USE_STATIC_LIBS ON)
FIND_PACKAGE(Boost COMPONENTS system filesystem thread serialization)

IF(Boost_FOUND)
    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
    LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
ENDIF(Boost_FOUND)

INCLUDE_DIRECTORIES(${Sleephi_SOURCE_DIR}/NetLib)
LINK_DIRECTORIES(${Sleephi_BINARY_DIR}/NetLib)

IF(MSVC)
    ADD_DEFINITIONS(/W4 /wd4819 -D_WIN32_WINNT=0x0501)
ELSE(MSVC)
    ADD_DEFINITIONS(-O3 -W -Wall -fPIC -std=c++0x)
ENDIF(MSVC)

ADD_SUBDIRECTORY(NetLib)
ADD_SUBDIRECTORY(EchoSvr)
ADD_SUBDIRECTORY(ChatSvr)
